package com.ruoyi.column.service.impl;

import java.util.List;

import com.ruoyi.common.constant.SysConstants;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.column.mapper.SysColumnPaperMapper;
import com.ruoyi.column.domain.SysColumnPaper;
import com.ruoyi.column.service.ISysColumnPaperService;

/**
 * 专栏试卷Service业务层处理
 * 
 * @author yjf
 */
@Service
public class SysColumnPaperServiceImpl implements ISysColumnPaperService 
{
    @Autowired
    private SysColumnPaperMapper sysColumnPaperMapper;

    /**
     * 查询专栏试卷
     * 
     * @param id 专栏试卷主键
     * @return 专栏试卷
     */
    @Override
    public SysColumnPaper selectSysColumnPaperById(Long id)
    {
        return sysColumnPaperMapper.selectSysColumnPaperById(id);
    }

    /**
     * 查询专栏试卷列表
     * 
     * @param sysColumnPaper 专栏试卷
     * @return 专栏试卷
     */
    @Override
    public List<SysColumnPaper> selectSysColumnPaperList(SysColumnPaper sysColumnPaper)
    {

        if (StringUtils.isNull(sysColumnPaper.getDelFlag())) {
            sysColumnPaper.setDelFlag(SysConstants.CONSTANT_STR0);
        }
        return sysColumnPaperMapper.selectSysColumnPaperList(sysColumnPaper);
    }

    /**
     * 新增专栏试卷
     * 
     * @param sysColumnPaper 专栏试卷
     * @return 结果
     */
    @Override
    public int insertSysColumnPaper(SysColumnPaper sysColumnPaper)
    {
        sysColumnPaper.setCreateTime(DateUtils.getNowDate());
        return sysColumnPaperMapper.insertSysColumnPaper(sysColumnPaper);
    }

    /**
     * 修改专栏试卷
     * 
     * @param sysColumnPaper 专栏试卷
     * @return 结果
     */
    @Override
    public int updateSysColumnPaper(SysColumnPaper sysColumnPaper)
    {
        sysColumnPaper.setUpdateTime(DateUtils.getNowDate());
        return sysColumnPaperMapper.updateSysColumnPaper(sysColumnPaper);
    }

    /**
     * 批量删除专栏试卷
     * 
     * @param ids 需要删除的专栏试卷主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnPaperByIds(Long[] ids)
    {
        return sysColumnPaperMapper.deleteSysColumnPaperByIds(ids);
    }

    /**
     * 删除专栏试卷信息
     * 
     * @param id 专栏试卷主键
     * @return 结果
     */
    @Override
    public int deleteSysColumnPaperById(Long id)
    {
        return sysColumnPaperMapper.deleteSysColumnPaperById(id);
    }
}
